﻿// <copyright file="Error.cs" company="Hallvard Korsgaard">
//  Microsoft Public License (Ms-PL). See license details here: http://enoceannet.codeplex.com/license
// </copyright>
// <author>Hallvard Korsgaard</author> 

namespace EnOcean.Message.Error
{
  using System;

  /// <summary>
  /// Standard error message response if after a TCT command the operation could not be carried out successfully by the TCM.
  /// </summary>
  [Serializable]
  public class Error : MessageTelegram
  {
    /// <summary>
    /// Creates the byte format of the message.
    /// </summary>
    /// <param name="message">A byte array of length 14 to hold the message contents.</param>
    protected internal override void CreateMessage(byte[] message)
    {
      base.CreateMessage(message);
      if (message[3] == 0)
      {
        message[3] = (byte)MessageType.Error;
      }
    }
  }
}
